Page({
    data: {
        isTimeLimit: false,
        goods: {}
    },

    onLoad(options) {
        const { goods, isTimeLimit } = options;

        try {
            const parsedGoods = JSON.parse(decodeURIComponent(goods));
            console.log(parsedGoods);
            this.setData({
                goods: parsedGoods,
                isTimeLimit: isTimeLimit === 'true'
            });
        } catch (e) {
            console.error('商品数据解析失败', e);
            wx.showToast({
                title: '商品数据有误',
                icon: 'none'
            });
        }
    },

    buyNow() {
        wx.showToast({
            title: '购买成功',
            icon: 'success'
        });
    }
});
